package com.sskj.jd.repository;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;

import com.sskj.core.query.annotation.DynamicQuery;
import com.sskj.core.repository.GenericRepository;
import com.sskj.jd.domain.JianDuJiLuQueryParam;
import com.sskj.jd.domain.entity.JianDuJiLu;

public interface JianDuJiLuRepository extends GenericRepository<JianDuJiLu, String> {

	@Query(value = " from JianDuJiLu x where 1=1 "
			+ "<notEmpty name='keyword'> and (x.coding like '%${keyword}%' or x.eng.engName like '%${keyword}%') </notEmpty> "
			+ "<notEmpty name='userid'> and x.creatorId=:userid </notEmpty> "
			+ "<notEmpty name='isUpload'> and x.isUpload=:isUpload </notEmpty>"
			+ "and x.jllx in ('0016','0010','0008','0009') order by x.createdTime desc ")
	@DynamicQuery
	Page<JianDuJiLu> findZlPage(JianDuJiLuQueryParam jianDuJiLuQueryParam, Pageable pageable);

	@Query(value = " from JianDuJiLu x where 1=1 "
			+ "<notEmpty name='keyword'> and (x.coding like '%${keyword}%' or x.eng.engName like '%${keyword}%') </notEmpty> "
			+ "<notEmpty name='userid'> and x.creatorId=:userid </notEmpty> "
			+ "<notEmpty name='isUpload'> and x.isUpload=:isUpload </notEmpty>"
			+ "and x.jllx in ('0021','0022','0052') order by x.createdTime desc ")
	@DynamicQuery
	Page<JianDuJiLu> findAqPage(JianDuJiLuQueryParam jianDuJiLuQueryParam, Pageable pageable);
}
